<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="content-type" content="no-cache, must-revalidate"/>
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT"/>
    <title>首页</title>
    <link href="css/swiper-5.4.5/swiper.min.css" rel="stylesheet">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/my.css" rel="stylesheet">
    <link href="css/nav.css" rel="stylesheet">

    <style>

        .notice-box li {
            float: left;
            text-align: center;
        }

        .notice-box li img {
            width: 100%
        }

    </style>
</head>
<body>
<div>
    <div class="nav-container-header">
        <div class="container" style="height: 100%">
            <div class="row" style="height: 100%">
                <div class="col-md-3"><img class="logo-img" src="/front/img/logo.png" alt="">
                    <div class="logo">公交查询系统</div>
                </div>
                <div class="col-md-7"><img class="header-img" src="/front/img/carousel/7.jpg" alt=""></div>
            </div>
        </div>
    </div>
    <div class="nav-container">
        <ul class="nav-item-box">
            <li><a class="nav-item active" href="index.html">首页</a></li>
            <li><a class="nav-item" href="advertiserInfo.html">公告信息</a></li>
			<li><a class="nav-item" href="pathInfo.html">公交车路线信息</a></li>
			<li><a class="nav-item" href="messageInfo.html">留言信息</a></li>

            <li><a class="nav-item" href="/end/page/index.html" target="_blank">进入后台系统</a></li>
        </ul>
        <div class="nav-right">
            <a class="nav-item" href="/end/page/login.html" target="_blank">登录</a>
            <a class="nav-item" href="/end/page/register.html" target="_blank">注册</a>
        </div>
    </div>

    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide"><img class="carousel-img" src="/front/img/carousel/6.jpg" alt=""></div>
            <div class="swiper-slide"><img class="carousel-img" src="/front/img/carousel/4.jpg" alt=""></div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>

        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>

    </div>

    <div style="color: #c35133; font-size: 20px; font-weight: bold; margin: 30px; text-align: center">
        系统公告
        <hr>
    </div>

    <div class="container">
        <ul class="row notice-box">
        </ul>
    </div>
</div>

<!--js库文件-->
<script src="js/jquery-1.10.2.js"></script>
<script src="js/swiper-5.4.5/swiper.min.js"></script>


<script>
    $(function () {

        var mySwiper = new Swiper('.swiper-container', {
            // direction: 'vertical', // 垂直切换选项
            autoplay: {
                delay: 5000,
                disableOnInteraction: false
            },//可选选项，自动滑动
            loop: true, // 循环模式选项
            speed: 2000,

            // 如果需要分页器
            pagination: {
                el: '.swiper-pagination',
                clickable: true
            },

            // 如果需要前进后退按钮
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev'
            }
        });

        // 鼠标移入停止自动滚动
        var $swiperSide = $('.swiper-slide');
        $swiperSide.mouseenter(function () {
            mySwiper.autoplay.stop();
        });
        // 鼠标移出开始自动滚动
        $swiperSide.mouseleave(function () {
            mySwiper.autoplay.start();
        })

        $.get('/advertiserInfo/page/all?pageSize=10', function (res) {
            let $box = $('.notice-box');
            $box.empty();
            let n = 4;
            if (res.code === '0') {
                let list = res.data.list;
                for (let i = 1; i <= n; i++) {
                    let data = list[i - 1];
                    let $item = $('<li class="col-md-3"><a href="advertiserInfo.html?id=' + data.id + '"><img src="/front/img/carousel/' + i + '.jpg">' + data.name + '</a></li>');
                    $box.append($item);
                }
            } else {
                alert("后台服务异常")
            }
        })
    })
</script>
</body>
</html>